<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDistributorPosterTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('distributor_poster', function (Blueprint $table) {
            $table->increments('id');
            $table->dateTime('created_at')->comment('创建时间');
            $table->dateTime('updated_at')->default(DB::raw('current_timestamp on update current_timestamp'))->comment('更新时间');
            $table->integer('user_id')->default(0)->comment('用户ID');
            $table->string('openid', 128)->default('')->comment('openid');
            $table->string('url')->default('')->comment('海报地址');
            $table->index('created_at');
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('distributor_poster');
    }
}
